var baiduMap = {};
    baiduMap = function(){
		var ary;
		var map;
		var point;
        return {
            add : function(id,json){
	            ary = new Array();
			    map = new BMap.Map(id);
			    map.enableScrollWheelZoom();
			    map.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT})); //右上角，仅包含平移和缩放按钮
			    map.addControl(new BMap.MapTypeControl({
				    mapTypes: [BMAP_NORMAL_MAP, BMAP_SATELLITE_MAP, BMAP_HYBRID_MAP],
				    anchor: BMAP_ANCHOR_TOP_LEFT
			    })); //2D图，卫星图
			    var data = eval(json);
				for(var i=0; i<data.length; i++){
					point = new BMap.Point(data[i]['itude'][0], data[i]['itude'][1]);
				    ary.push(new BMap.Point(data[i]['itude'][0], data[i]['itude'][1]));
				    this.addMarker(point, data[i]['hotel_code'], data[i]['logo'], data[i]['price']);
				}
            },
            addMarker: function(point , code , pic , price){
                var marker = new BMap.Marker(point);
                map.addOverlay(marker);
                var jsondata = map.getViewport(ary);
                map.centerAndZoom(jsondata.center, jsondata.zoom - 1);
                var sContent = "<div><span><img src='"+pic+"'></span><span><font>"+price+"</font>起</span></div>";
                var infoWindow = new BMap.InfoWindow(sContent); // 创建信息窗口对象
                var label = new BMap.Label(sContent, { offset: new BMap.Size(0, -40) });
                marker.setLabel(label);
                label.setStyle({border: "none",cursor: "pointer"});
                infoWindow.addEventListener("open", function(){
                    marker.getLabel().hide();
                });
                infoWindow.addEventListener("close", function(){
                    marker.getLabel().show();
                });
                label.addEventListener("click", function(){
//                    window.open('index.php?app=home&act=content&hotelId=' + hotelId + '');
					location.href='index.php?app=home&act=content&code=' + code + '';
                });
            }
        }
    }();